import sys,traceback,Ice
Ice.loadSlice("Printer.ice")
import QuerySystem 

status = 0
ic = None
try:
    ic = Ice.initialize(sys.argv)
    base = ic.stringToProxy("SimplePrinter:default -p 10000")
    printer = QuerySystem.QueryResultsPrx.checkedCast(base)
    if not printer:
        raise RuntimeError("Invalid Proxy")
    result = printer.QueryByNo("Hello World!")
    print(result)
except:
    traceback.print_exc()
    status = 1

if ic:
    try:
        ic.destroy()
    except:
        traceback.print_exc()
        status = 1
sys.exit(status)
